Date.prototype.getDays=function(){
	return 32-(new Date(this.getFullYear(),this.getMonth(),32).getDate());
};
function DatePicker(){
	this.dtaA = new Date(); 	
	var dtaTxt = this.dtaA.getDate()+"-"+(this.dtaA.getMonth()+1)+"-"+this.dtaA.getFullYear();
	InputText.apply(this,[dtaTxt]);
	this.setSize(3);
	//this.setIcon("icon-th");
	this.setIcon("calendar");//calendar
	this.htmlX.addClass("DatePicker");
	this.htmlX.find(".inputtt").addClass("date").attr({"date-format":"dd-MM-yyyy","data-date":dtaTxt});
	this.htmlX[0]["dta"] = this;	
	this.htmlX.find(".addon1").click($.proxy(this.showCalendar,this));
}

DatePicker.prototype = Object.create(InputText.prototype);
DatePicker.prototype.constructor = DatePicker;

DatePicker.prototype.showCalendar = function(){	  
    this.htmlX.find(".inputtt").datepicker({format: "dd-mm-yyyy",language: "pt-BR"}).datepicker('show');    
};

DatePicker.prototype.addDate = function(typeD,pluss){	
	var tipoS = {"date":0,"month":0,"year":0};
	tipoS[typeD] = pluss;
	this.dtaA.setFullYear(this.dtaA.getFullYear()+tipoS.year,this.dtaA.getMonth()+tipoS.month,this.dtaA.getDate()+tipoS.date);
	var dtaTxt = (this.dtaA.getDate())+"-"+(this.dtaA.getMonth()+1)+"-"+(this.dtaA.getFullYear());
	this.setValue(dtaTxt);
};
DatePicker.prototype.setDate = function(typeD,vl){	
	var tipoS = {"date":this.dtaA.getDate(),"month":this.dtaA.getMonth()+1,"year":this.dtaA.getFullYear()};
	tipoS[typeD] = vl;
	this.dtaA.setFullYear(tipoS.year,tipoS.month-1,tipoS.date);
	var dtaTxt = (this.dtaA.getDate())+"-"+(this.dtaA.getMonth()+1)+"-"+(this.dtaA.getFullYear()); 
	this.setValue(dtaTxt);    
};